//
//  UIView+Extension.m
//  LYProfiles
//
//  Created by boom on 2017/6/8.
//  Copyright © 2017年 boomLi. All rights reserved.
//

#import "UIView+Extension.h"

@implementation UIView (Extension)

- (CGSize)ftn_size
{
    return self.frame.size;
}

- (void)setFtn_size:(CGSize)ftn_size
{
    CGRect frame = self.frame;
    frame.size = ftn_size;
    self.frame = frame;
}

- (CGFloat)ftn_width
{
    return self.frame.size.width;
}

- (CGFloat)ftn_height
{
    return self.frame.size.height;
}

- (void)setFtn_width:(CGFloat)ftn_width
{
    CGRect frame = self.frame;
    frame.size.width = ftn_width;
    self.frame = frame;
}

- (void)setFtn_height:(CGFloat)ftn_height
{
    CGRect frame = self.frame;
    frame.size.height = ftn_height;
    self.frame = frame;
}

- (CGFloat)ftn_x
{
    return self.frame.origin.x;
}

- (void)setFtn_x:(CGFloat)ftn_x
{
    CGRect frame = self.frame;
    frame.origin.x = ftn_x;
    self.frame = frame;
}

- (CGFloat)ftn_y
{
    return self.frame.origin.y;
}

- (void)setFtn_y:(CGFloat)ftn_y
{
    CGRect frame = self.frame;
    frame.origin.y = ftn_y;
    self.frame = frame;
}

-(CGPoint)ftn_center{
    return CGPointMake(self.frame.origin.x + self.frame.size.width * 0.5,
                       self.frame.origin.y + self.frame.size.height * 0.5);
}


-(void)setFtn_center:(CGPoint)ftn_center{
    CGRect frame = self.frame;
    frame.origin.x = ftn_center.x - frame.size.width * 0.5;
    frame.origin.y = ftn_center.y - frame.size.height * 0.5;
    self.frame = frame;
}

- (CGFloat)ftn_centerX
{
    return self.center.x;
}

- (void)setFtn_centerX:(CGFloat)ftn_centerX
{
    CGPoint center = self.center;
    center.x = ftn_centerX;
    self.center = center;
}

- (CGFloat)ftn_centerY
{
    return self.center.y;
}

- (void)setFtn_centerY:(CGFloat)ftn_centerY
{
    CGPoint center = self.center;
    center.y = ftn_centerY;
    self.center = center;
}

- (CGFloat)ftn_right
{
    //    return self.ftn_x + self.ftn_width;
    return CGRectGetMaxX(self.frame);
}

- (CGFloat)ftn_bottom
{
    //    return self.ftn_y + self.ftn_height;
    return CGRectGetMaxY(self.frame);
}

- (void)setFtn_right:(CGFloat)ftn_right
{
    self.ftn_x = ftn_right - self.ftn_width;
}

- (void)setFtn_bottom:(CGFloat)ftn_bottom
{
    self.ftn_y = ftn_bottom - self.ftn_height;
}

@end
